using System;
using System.Globalization;
using System.Linq;
using System.Windows;
using FU.Capstones.IMS.Web.Common.MultiBindingHelpers;

namespace FU.Capstones.IMS.Web.Common.Converters
{
    public class MultiBoolsToVisibilityConverter : IMultiValueConverter
    {
        #region Implementation of IMultiValueConverter

        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values.Cast<bool?>().Any(b => b.HasValue && b.Value))
            {
                return Visibility.Visible;
            }
            return Visibility.Collapsed;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
